package com.qf.osmarea.controller;

import com.qf.common.core.annotation.NoLogin;
import com.qf.common.core.common.R;
import com.qf.common.core.entity.area.Area;
import com.qf.osmarea.param.DeleteParam;
import com.qf.osmarea.service.AreaService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Qu Xiaotong
 * @data 2025/6/11
 * @desc
 */
@RestController
@RequestMapping("/area")
public class AreaController {

    @Resource
    private AreaService areaService;

    /**
     * 获取所有收货地址
     * @return
     */
    @GetMapping("/getArea")
    public R getArea(){

        List<Area> list =areaService.getArea();

        return R.ok(list);
    }

    /**
     * 添加收货地址
     * @param area
     * @return
     */
    @PostMapping("addArea")
    public R addArea(Area area){

        areaService.addArea(area);

        return R.ok();
    }

    /**
     * 删除收货地址
     * @param
     * @return
     */
    @RequestMapping("deleteArea")
    public R deleteArea(DeleteParam deleteParam){

        areaService.deleteArea(deleteParam);

        return R.ok();
    }

    /**
     * 修改收获地址
     * @param area
     * @return
     */
    @RequestMapping("patchArea")
    public R patchArea(Area area){

        areaService.updateArea(area);
        return R.ok();
    }






}
